<template>
  <div class="main">
    <div class="top-main">
      <dz-nav :is-back="true" :back-url="'/my'">
        <template #center>
          <b v-color><qq>RevenueDetails</qq></b>
        </template>
      </dz-nav>
    </div>
    <div class="list">
      <div class="noData" v-if="initFinish&&lists.length === 0">
        <img src="@/assets/images/img_search_result.png" alt="" class="img-noData">
        <p><qq>Norecords</qq></p>
      </div>
      <div class="lists" v-else>
        <van-list
            v-model:loading="loading"
            :finished="finished"
            :finished-text="$t('thereIsNoMoreDataAvailable')"
            @load="onLoad"
        >
          <div class="item" v-for="(item, index) in lists" :key="index">
            <p>
              <span class="span">{{item.orderNumber}}</span>
              <span class="desc">{{ item.remark }}</span>
            </p>
            <p>
              <span class="money">{{item.money}} USDT</span>
              <span>{{item.createTime}}</span>
            </p>
          </div>
        </van-list>
      </div>
    </div>
  </div>
</template>

<script>
import { incomeList } from '@/api/apiFox'
export default {
  data(){
    return{
      pageNo: 0,
      count: 0,
      finished: false,
      loading: false,
      initFinish: false,
      lists: []
    }
  },
  methods: {
    getLists() {
      incomeList({ pageNo: this.pageNo, pageSize: 15 }).then(res => {
        this.lists = this.lists.concat(res.data)
        this.count = res.count
        this.initFinish = true
        this.loading = false
      }).catch(err => {})
    },
    onLoad() {
      if(this.pageNo === 0) {
        this.pageNo ++
        this.getLists()
      }else{
        if(this.lists.length < this.count) {
          this.pageNo ++
          this.getLists()
        }else{
          this.finished = true
        }
      }
    }
  }
}
</script>

<style scoped lang="scss">
.main{
  width: 100%;
  min-height: 100vh;
  background: url("@/assets/images/bg.jpg") top center no-repeat;
  background-attachment: fixed;
  background-size: 100% 100%;
  border-radius: 0;
  .top-main{
    width: 100%;
  }
  .list{
    height: calc(100vh - 50px);
    background: linear-gradient( 180deg, #FFF0C9 0%, #D49188 100%);
    box-shadow: inset 0px 4px 4px 0px rgba(255,255,255,0.25);
    border-radius: 30px 30px 0px 0px;
    padding: 30px 15px;
    box-sizing: border-box;
    .noData{
      text-align: center;
      font-size: 14px;
      color: rgba(0,0,0,0.3);
      padding-top: 180px;
      img{
        width: 140px;
        height: 140px;
      }
    }
    .lists{
      height: 100%;
      background: #FFFFFF;
      border-radius: 20px;
      padding: 20px;
      box-sizing: border-box;
      overflow: hidden;
      overflow-y: auto;
      .item{
        padding: 10px 0;
        border-bottom: 1px solid rgba(133,133,138,0.2);
        p{
          display: flex;
          justify-content: space-between;
          font-size: 12px;
          color: #5B6B86;
          &:first-child{
            margin-bottom: 5px;
          }
          .span{
            flex-shrink: 0;
            margin-right: 20px;
          }
          .desc{
            font-size: 14px;
            color: #242B35;
            word-break: break-all;
          }
          .money{
            font-weight: bold;
            font-size: 14px;
            color: #533DF1;
            flex-shrink: 0;
          }
        }
      }
    }
  }
}
</style>